package com.qingfeng.entity.activiti;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author cb
 * @Description TODO
 * @date 2023/6/7
 */
@Getter
@AllArgsConstructor
public enum BusinessStatusEnum {
    CANCEL(-1, "已撤回"), WAIT(0, "待提交"), PROCESS(1, "处理中"),
    FINISH(2, "已完成"), INVALID(3, "已作废"), DELETE(4, "已删除");
    private Integer code;
    private String desc;

    public static BusinessStatusEnum getEumByCode(Integer code){
        if(code == null) return null;

        for(BusinessStatusEnum statusEnum: BusinessStatusEnum.values()) {
            if(statusEnum.getCode() == code) {
                return statusEnum;
            }
        }
        return null;
    }
}
